home *** CD-ROM | disk | FTP | other *** search
Wrap
ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) zzzzsssshhhh vvvveeeerrrrssssiiiioooonnnn 3333....0000 ((((JJJJuuuunnnneeee 22226666,,,, 1111999999996666)))) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) NNNNAAAAMMMMEEEE zshmisc - Everything and then some SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS Everything I haven't put somewhere else SSSSHHHHEEEELLLLLLLL GGGGRRRRAAAAMMMMMMMMAAAARRRR A _s_i_m_p_l_e _c_o_m_m_a_n_d is a sequence of optional parameter assignments followed by blank-separated words, with optional redirections interspersed. The first word is the command to be executed, and the remaining words, if any, are arguments to the command. If a command name is given, the parameter assignments modify the environment of the command when it is executed. The value of a simple command is its exit status, or 128 plus the signal number if terminated by a signal. A _p_i_p_e_l_i_n_e is a sequence of one or more commands separated by |||| or ||||&&&&. ||||&&&& is shorthand for 2222>>>>&&&&1111 ||||. The standard output of each command is connected to the standard input of the next command in the pipeline. If a pipeline is preceded by ccccoooopppprrrroooocccc, it is executed as a coprocess; a two-way pipe is established between it and the parent shell. The shell can read from or write to the coprocess by means of the >>>>&&&&pppp and <<<<&&&&pppp redirection operators. The value of a pipeline is the value of the last command. If a pipeline is preceded by a !!!!, the value of that pipeline is the logical NOT of the value of the last command. A _s_u_b_l_i_s_t is a sequence of one or more pipelines separated by &&&&&&&& or ||||||||. If two pipelines are separated by &&&&&&&&, the second pipeline is executed only if the first is successful (returns a zero value). If two pipelines are separated by ||||||||, the second is executed only if the first is unsuccessful (returns a nonzero value). Both operators have equal precedence and are left associative. A _l_i_s_t is a sequence of zero or more sublists separated by, and optionally terminated by, ;;;;, &&&&, &&&&||||, &&&&!!!! or a newline. Normally the shell waits for each list to finish before executing the next one. If a list is terminated by &&&&, &&&&|||| or &&&&!!!!, the shell executes it in the background, and does not wait for it to finish. PPPPRRRREEEECCCCOOOOMMMMMMMMAAAANNNNDDDD MMMMOOOODDDDIIIIFFFFIIIIEEEERRRRSSSS A simple command may be preceded by a _p_r_e_c_o_m_m_a_n_d modifier which will alter how the command is interpreted. These modifiers are shell builtin commands with the exception of nnnnooooccccoooorrrrrrrreeeecccctttt which is a reserved word. ---- The command is executed with a ---- prepended to its aaaarrrrggggvvvv[[[[0000]]]] string. nnnnoooogggglllloooobbbb Page 1 (printed 4/24/98) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) zzzzsssshhhh vvvveeeerrrrssssiiiioooonnnn 3333....0000 ((((JJJJuuuunnnneeee 22226666,,,, 1111999999996666)))) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) Filename generation (globbing) is not performed on any of the words. nnnnooooccccoooorrrrrrrreeeecccctttt Spelling correction is not done on any of the words. eeeexxxxeeeecccc The command is executed in the parent shell without forking. ccccoooommmmmmmmaaaannnndddd The command word is taken to be the name of an external command, rather than a shell function or builtin. CCCCOOOOMMMMPPPPLLLLEEEEXXXX CCCCOOOOMMMMMMMMAAAANNNNDDDDSSSS A _c_o_m_p_l_e_x _c_o_m_m_a_n_d in zsh is one of the following: iiiiffff _l_i_s_t tttthhhheeeennnn _l_i_s_t [ eeeelllliiiiffff _l_i_s_t tttthhhheeeennnn _l_i_s_t ] ... [ eeeellllsssseeee _l_i_s_t ] ffffiiii The iiiiffff _l_i_s_t is executed, and, if it returns a zero exit status, the tttthhhheeeennnn _l_i_s_t is executed. Otherwise, the eeeelllliiiiffff _l_i_s_t is executed and, if its value is zero, the tttthhhheeeennnn _l_i_s_t is executed. If each eeeelllliiiiffff _l_i_s_t returns nonzero, the eeeellllsssseeee _l_i_s_t is executed. ffffoooorrrr _n_a_m_e [ iiiinnnn _w_o_r_d ... _t_e_r_m ] ddddoooo _l_i_s_t ddddoooonnnneeee where _t_e_r_m is one ore more newline or ;;;;. Expand the list of _w_o_r_ds, and set the parameter _n_a_m_e to each of them in turn, executing _l_i_s_t each time. If the iiiinnnn _w_o_r_d is omitted, use the positional parameters instead of the _w_o_r_ds. wwwwhhhhiiiilllleeee _l_i_s_t ddddoooo _l_i_s_t ddddoooonnnneeee Execute the ddddoooo _l_i_s_t as long as the wwwwhhhhiiiilllleeee _l_i_s_t returns a zero exit status. uuuunnnnttttiiiillll _l_i_s_t ddddoooo _l_i_s_t ddddoooonnnneeee Execute the ddddoooo _l_i_s_t as long as uuuunnnnttttiiiillll _l_i_s_t returns a nonzero exit status. rrrreeeeppppeeeeaaaatttt _w_o_r_d ddddoooo _l_i_s_t ddddoooonnnneeee _w_o_r_d is expanded and treated as an arithmetic expression, which must evaluate to a number _n. _l_i_s_t is then executed nnnn times. ccccaaaasssseeee _w_o_r_d iiiinnnn [ [((((] _p_a_t_t_e_r_n [ |||| _p_a_t_t_e_r_n ] ... )))) _l_i_s_t ;;;;;;;; ] ... eeeessssaaaacccc Execute the _l_i_s_t associated with the first _p_a_t_t_e_r_n that matches _w_o_r_d, if any. The form of the patterns is the same as that used for filename generation. See _F_i_l_e_n_a_m_e _G_e_n_e_r_a_t_i_o_n below. sssseeeelllleeeecccctttt _n_a_m_e [ iiiinnnn _w_o_r_d ... _t_e_r_m ] ddddoooo _l_i_s_t ddddoooonnnneeee where _t_e_r_m is one ore more newline or ;;;;. Print the set of _w_o_r_ds, each preceded by a number. If the iiiinnnn _w_o_r_d is omitted, use the positional parameters. The PPPPRRRROOOOMMMMPPPPTTTT3333 prompt is printed and a line is read from standard input. If this line consists of the number of one of Page 2 (printed 4/24/98) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) zzzzsssshhhh vvvveeeerrrrssssiiiioooonnnn 3333....0000 ((((JJJJuuuunnnneeee 22226666,,,, 1111999999996666)))) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) the listed _w_o_r_ds, then the parameter _n_a_m_e is set to the _w_o_r_d corresponding to this number. If this line is empty, the selection list is printed again. Otherwise, the value of the parameter _n_a_m_e is set to null. The contents of the line read from standard input is saved in the parameter RRRREEEEPPPPLLLLYYYY. _l_i_s_t is executed for each selection until a break or end-of-file is encountered. (((( _l_i_s_t )))) Execute _l_i_s_t in a subshell. Traps set by the ttttrrrraaaapppp builtin are reset to their default values while executing _l_i_s_t. {{{{ _l_i_s_t }}}} Execute _l_i_s_t. ffffuuuunnnnccccttttiiiioooonnnn _w_o_r_d ... [ (((()))) ] [ _t_e_r_m ] {{{{ _l_i_s_t }}}} _w_o_r_d ... (((()))) [ _t_e_r_m ] {{{{ _l_i_s_t }}}} _w_o_r_d ... (((()))) [ _t_e_r_m ] _c_o_m_m_a_n_d where _t_e_r_m is one ore more newline or ;;;;. Define a function which is referenced by any one of _w_o_r_d. Normally, only one _w_o_r_d is provided; multiple _w_o_r_ds are usually only useful for setting traps. The body of the function is the _l_i_s_t between the {{{{ and }}}}. See FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNNSSSS below. ttttiiiimmmmeeee [ _p_i_p_e_l_i_n_e ] The _p_i_p_e_l_i_n_e is executed, and timing statistics are reported on the standard error in the form specified by the TTTTIIIIMMMMEEEEFFFFMMMMTTTT parameter. If _p_i_p_e_l_i_n_e is omitted, print statistics about the shell process and its children. [[[[[[[[ _e_x_p ]]]]]]]] Evaluates the conditional expression _e_x_p and return a zero exit status if it is true. See CCCCoooonnnnddddiiiittttiiiioooonnnnaaaallll EEEExxxxpppprrrreeeessssssssiiiioooonnnnssss below for a description of _e_x_p. AAAALLLLTTTTEEEERRRRNNNNAAAATTTTEEEE FFFFOOOORRRRMMMMSSSS FFFFOOOORRRR CCCCOOOOMMMMPPPPLLLLEEEEXXXX CCCCOOOOMMMMMMMMAAAANNNNDDDDSSSS Many of zsh's complex commands have alternate forms. These particular versions of complex commands should be considered deprecated and may be removed in the future. The versions in the previous section should be preferred instead. The short versions below only work if _s_u_b_l_i_s_t is of the form {{{{ _l_i_s_t }}}} or if the NNNNOOOO____SSSSHHHHOOOORRRRTTTT____LLLLOOOOOOOOPPPPSSSS option is not set. iiiiffff _l_i_s_t {{{{ _l_i_s_t }}}} [ eeeelllliiiiffff _l_i_s_t {{{{ _l_i_s_t }}}} ] ... [ eeeellllsssseeee {{{{ _l_i_s_t }}}} ] An alternate form of iiiiffff. iiiiffff _l_i_s_t _s_u_b_l_i_s_t A short form of previous one. ffffoooorrrr _n_a_m_e (((( _w_o_r_d ... )))) _s_u_b_l_i_s_t Page 3 (printed 4/24/98) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) zzzzsssshhhh vvvveeeerrrrssssiiiioooonnnn 3333....0000 ((((JJJJuuuunnnneeee 22226666,,,, 1111999999996666)))) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) A short form of ffffoooorrrr. ffffoooorrrr _n_a_m_e [ iiiinnnn _w_o_r_d ... _t_e_r_m ] _s_u_b_l_i_s_t where _t_e_r_m is one ore more newline or ;;;;. Another short form of ffffoooorrrr. ffffoooorrrreeeeaaaacccchhhh _n_a_m_e (((( _w_o_r_d ... )))) _l_i_s_t eeeennnndddd Another form of ffffoooorrrr. wwwwhhhhiiiilllleeee _l_i_s_t {{{{ _l_i_s_t }}}} An alternative form of wwwwhhhhiiiilllleeee. uuuunnnnttttiiiillll _l_i_s_t {{{{ _l_i_s_t }}}} An alternative form of uuuunnnnttttiiiillll. rrrreeeeppppeeeeaaaatttt _w_o_r_d _s_u_b_l_i_s_t This is a short form of rrrreeeeppppeeeeaaaatttt. ccccaaaasssseeee _w_o_r_d {{{{ [ [((((] _p_a_t_t_e_r_n [ |||| _p_a_t_t_e_r_n ] ... )))) _l_i_s_t ;;;;;;;; ] ... }}}} An alternative form of ccccaaaasssseeee. sssseeeelllleeeecccctttt _n_a_m_e [ iiiinnnn _w_o_r_d _t_e_r_m ] _s_u_b_l_i_s_t where _t_e_r_m is one ore more newline or ;;;;. A short form of sssseeeelllleeeecccctttt. RRRREEEESSSSEEEERRRRVVVVEEEEDDDD WWWWOOOORRRRDDDDSSSS The following words are recognized as reserved words when used as the first word of a command unless quoted or disabled using ddddiiiissssaaaabbbblllleeee ----rrrr: ddddoooo ddddoooonnnneeee eeeessssaaaacccc tttthhhheeeennnn eeeelllliiiiffff eeeellllsssseeee ffffiiii ffffoooorrrr ccccaaaasssseeee iiiiffff wwwwhhhhiiiilllleeee ffffuuuunnnnccccttttiiiioooonnnn rrrreeeeppppeeeeaaaatttt ttttiiiimmmmeeee uuuunnnnttttiiiillll sssseeeelllleeeecccctttt ccccoooopppprrrroooocccc nnnnooooccccoooorrrrrrrreeeecccctttt ffffoooorrrreeeeaaaacccchhhh eeeennnndddd !!!! [[[[[[[[ {{{{ }}}} Additionally }}}} is recognized in any position if the IIIIGGGGNNNNOOOORRRREEEE____BBBBRRRRAAAACCCCEEEESSSS option is not set. CCCCOOOOMMMMMMMMEEEENNNNTTTTSSSS In noninteractive shells, or in interactive shells with the IIIINNNNTTTTEEEERRRRAAAACCCCTTTTIIIIVVVVEEEE____CCCCOOOOMMMMMMMMEEEENNNNTTTTSSSS option set, a word beginning with the third character of the hhhhiiiissssttttcccchhhhaaaarrrrssss parameter (`#' by default) causes that word and all the following characters up to a newline to be ignored. AAAALLLLIIIIAAAASSSSIIIINNNNGGGG Every token in the shell input is checked to see if there is an alias defined for it. If so, it is replaced by the text of the alias if it is in command position (if it could be the first word of a simple command), or if the alias is global. If the text ends with a space, the next word in the shell input is treated as though it were in command position for purposes of alias expansion. An alias is defined using Page 4 (printed 4/24/98) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) zzzzsssshhhh vvvveeeerrrrssssiiiioooonnnn 3333....0000 ((((JJJJuuuunnnneeee 22226666,,,, 1111999999996666)))) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) the aaaalllliiiiaaaassss builtin; global aliases may be defined using the -gggg option to that builtin. Alias substitution is done on the shell input before any other substitution except history substitution. Therefore, if an alias is defined for the word ffffoooooooo, alias substitution may be avoided by quoting part of the word, e.g. \\\\ffffoooooooo. But there is nothing to prevent an alias being defined for \\\\ffffoooooooo as well. QQQQUUUUOOOOTTTTIIIINNNNGGGG A character may be _q_u_o_t_e_d (that is, made to stand for itself) by preceding it with a \. \ followed by a newline is ignored. All characters enclosed between a pair of single quotes ('') are quoted. A single quote cannot appear within single quotes. Inside double quotes (""), parameter and command substitution occurs, and \ quotes the characters \, `, ", and $. RRRREEEEDDDDIIIIRRRREEEECCCCTTTTIIIIOOOONNNN Before a command is executed, its input and output may be redirected. The following may appear anywhere in a simple command or may precede or follow a complex command. Substitution occurs before _w_o_r_d or _d_i_g_i_t is used except as noted below. If the result of substitution on _w_o_r_d produces more than one filename, redirection occurs for each separate filename in turn. <<<<_w_o_r_d Open file _w_o_r_d as standard input. <<<<>>>>_w_o_r_d Open file _w_o_r_d for reading and writing as standard input. If the file does not exist then it is created. >>>>_w_o_r_d Open file _w_o_r_d as standard output. If the file does not exist then it is created. If the file exists, and the CCCCLLLLOOOOBBBBBBBBEEEERRRR option is unset, this causes an error; otherwise, it is truncated to zero length. >>>>|||| _w_o_r_d >>>>!!!! _w_o_r_d Same as >>>>, except that the file is truncated to zero length if it exists, even if CCCCLLLLOOOOBBBBBBBBEEEERRRR is unset. >>>>>>>>_w_o_r_d Open file _w_o_r_d as standard output. If the file exists then output is appended to it. If the file does not exist, and the CCCCLLLLOOOOBBBBBBBBEEEERRRR option is unset, this causes an error; otherwise, the file is created. Page 5 (printed 4/24/98) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) zzzzsssshhhh vvvveeeerrrrssssiiiioooonnnn 3333....0000 ((((JJJJuuuunnnneeee 22226666,,,, 1111999999996666)))) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) >>>>>>>>|||| _w_o_r_d >>>>>>>>!!!! _w_o_r_d Same as >>>>>>>>, except that the file is created if it does not exist, even if CCCCLLLLOOOOBBBBBBBBEEEERRRR is unset. <<<<<<<<[-] _w_o_r_d The shell input is read up to a line that is the same as _w_o_r_d, or to an end-of-file. No parameter substitution, command substitution or filename generation is performed on _w_o_r_d. The resulting document, called a _h_e_r_e-_d_o_c_u_m_e_n_t, becomes the standard input. If any character of _w_o_r_d is quoted with single or double quotes or a \, no interpretation is placed upon the characters of the document. Otherwise, parameter and command substitution occurs, \ followed by a newline is removed, and \ must be used to quote the characters \, $, `, and the first character of _w_o_r_d. If <<- is used, then all leading tabs are stripped from _w_o_r_d and from the document. <<<<<<<<<<<<_w_o_r_d Perform shell expansion on _w_o_r_d and pass the result to standard input. <<<<&&&&_d_i_g_i_t The standard input is duplicated from file descriptor _d_i_g_i_t (see _d_u_p(2)). Similarly for standard output using >>>>&&&&_d_i_g_i_t.... >>>>&&&&_w_o_r_d Same as >>>>_w_o_r_d 2222>>>>&&&&1. >>>>>>>>&&&&_w_o_r_d Same as >>>>>>>>_w_o_r_d 2222>>>>&&&&1. <<<<&&&&---- Close the standard input. >>>>&&&&---- Close the standard output. <<<<&&&&pppp The input from the coprocess is moved to the standard input. >>>>&&&&pppp The output to the coprocess is moved to the standard output. If one of the above is preceded by a digit, then the file descriptor referred to is that specified by the digit (instead of the default 0 or 1). The order in which redirections are specified is significant. The shell evaluates each redirection in terms of the (_f_i_l_e _d_e_s_c_r_i_p_t_o_r, _f_i_l_e) association at the time of evaluation. For example: Page 6 (printed 4/24/98) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) zzzzsssshhhh vvvveeeerrrrssssiiiioooonnnn 3333....0000 ((((JJJJuuuunnnneeee 22226666,,,, 1111999999996666)))) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) ... 1>_f_n_a_m_e 2>&1 first associates file descriptor 1 with file _f_n_a_m_e. It then associates file descriptor 2 with the file associated with file descriptor 1 (that is, _f_n_a_m_e). If the order of redirections were reversed, file descriptor 2 would be associated with the terminal (assuming file descriptor 1 had been) and then file descriptor 1 would be associated with file _f_n_a_m_e. If the user tries to open a file descriptor for writing more than once, the shell opens the file descriptor as a pipe to a process that copies its input to all the specified outputs, similar to tee(1), provided the MMMMUUUULLLLTTTTIIIIOOOOSSSS option is set. Thus: ddddaaaatttteeee >>>>ffffoooooooo >>>>bbbbaaaarrrr writes the date to two files, named "foo" and "bar". Note that a pipe is an implicit indirection; thus ddddaaaatttteeee >>>>ffffoooooooo |||| ccccaaaatttt writes the date to the file "foo", and also pipes it to cat. If the MMMMUUUULLLLTTTTIIIIOOOOSSSS option is set, the word after a redirection operator is also subjected to filename generation (globbing). Thus :::: >>>> **** will truncate all files in the current directory, assuming there's at least one. (Without the MMMMUUUULLLLTTTTIIIIOOOOSSSS option, it would create an empty file called "*".) If the user tries to open a file descriptor for reading more than once, the shell opens the file descriptor as a pipe to a process that copies all the specified inputs to its output in the order specified, similar to cat(1), provided the MMMMUUUULLLLTTTTIIIIOOOOSSSS option is set. Thus ssssoooorrrrtttt <<<<ffffoooooooo <<<<ffffuuuubbbbaaaarrrr or even ssssoooorrrrtttt <<<<ffff{{{{oooooooo,,,,uuuubbbbaaaarrrr}}}} is equivalent to "cat foo fubar | sort". Similarly, you can do eeeecccchhhhoooo eeeexxxxiiiitttt 0000 >>>>>>>> ****....sssshhhh Page 7 (printed 4/24/98) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) zzzzsssshhhh vvvveeeerrrrssssiiiioooonnnn 3333....0000 ((((JJJJuuuunnnneeee 22226666,,,, 1111999999996666)))) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) Note that a pipe is in implicit indirection; thus ccccaaaatttt bbbbaaaarrrr |||| ssssoooorrrrtttt <<<<ffffoooooooo is equivalent to "cat bar foo | sort" (note the order of the inputs). If the MMMMUUUULLLLTTTTIIIIOOOOSSSS option is _u_nset, each redirection replaces the previous redirection for that file descriptor. However, all files redirected to are actually opened, so eeeecccchhhhoooo ffffoooooooo >>>> bbbbaaaarrrr >>>> bbbbaaaazzzz when MMMMUUUULLLLTTTTIIIIOOOOSSSS is unset will truncate bar, and write "foo" into baz. If a simple command consists of one or more redirection operators and zero or more parameter assignments, but no command name, the command ccccaaaatttt is assumed. Thus <<<< ffffiiiilllleeee prints the contents of ffffiiiilllleeee. If a command is followed by &&&& and job control is not active, then the default standard input for the command is the empty file ////ddddeeeevvvv////nnnnuuuullllllll. Otherwise, the environment for the execution of a command contains the file descriptors of the invoking shell as modified by input/output specifications. CCCCOOOOMMMMMMMMAAAANNNNDDDD EEEEXXXXEEEECCCCUUUUTTTTIIIIOOOONNNN If a command name contains no slashes, the shell attempts to locate it. If there exists a shell function by that name, the function is invoked as described below in FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNNSSSS. If there exists a shell builtin by that name, the builtin is invoked. Otherwise, the shell searches each element of ppppaaaatttthhhh for a directory containing an executable file by that name. If the search is unsuccessful, the shell prints an error message and returns a nonzero exit status. If execution fails because the file is not in executable format, and the file is not a directory, it is assumed to be a shell script. /bin/sh is spawned to execute it. If the program is a file beginning with ####!!!!, the remainder of the first line specifies an interpreter for the program. The shell will execute the specified interpreter on operating systems that do not handle this executable format in the kernel. FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNNSSSS PPPPaaaaggggeeee 8888 ((((pppprrrriiiinnnntttteeeedddd 4444////22224444////99998888)))) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) zzzzsssshhhh vvvveeeerrrrssssiiiioooonnnn 3333....0000 ((((JJJJuuuunnnneeee 22226666,,,, 1111999999996666)))) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) The ffffuuuunnnnccccttttiiiioooonnnn reserved word is used to define shell functions. Shell functions are read in and stored internally. Alias names are resolved when the function is read. Functions are executed like commands with the arguments passed as positional parameters. (See _E_x_e_c_u_t_i_o_n below). Functions execute in the same process as the caller and share all files and present working directory with the caller. A trap on EEEEXXXXIIIITTTT set inside a function is executed after the function completes in the environment of the caller. The rrrreeeettttuuuurrrrnnnn builtin is used to return from function calls. Function identifiers can be listed with the ffffuuuunnnnccccttttiiiioooonnnnssss builtin. Functions can be undefined with the uuuunnnnffffuuuunnnnccccttttiiiioooonnnn builtin. The following functions, if defined, have special meaning to the shell: cccchhhhppppwwwwdddd Executed whenever the current working directory is changed. pppprrrreeeeccccmmmmdddd Executed before each prompt. ppppeeeerrrriiiiooooddddiiiicccc If the parameter PPPPEEEERRRRIIIIOOOODDDD is set, this function is executed every PPPPEEEERRRRIIIIOOOODDDD seconds, just before a prompt. TTTTRRRRAAAAPPPPxxxxxxxxxxxx If defined and non-null, this function will be executed whenever the shell catches a signal SSSSIIIIGGGGxxxxxxxxxxxx, where xxxxxxxxxxxx is a signal name as specified for the kkkkiiiillllllll builtin (see below). The signal number will be passed as the first parameter to the function. In addition, TTTTRRRRAAAAPPPPZZZZEEEERRRRRRRR is executed whenever a command has a non-zero exit status, TTTTRRRRAAAAPPPPDDDDEEEEBBBBUUUUGGGG is executed after each command, and TTTTRRRRAAAAPPPPEEEEXXXXIIIITTTT is executed when the shell exits, or when the current function exits if defined inside a function. If a function of this form is defined and null, the shell and processes spawned by it will ignore SSSSIIIIGGGGxxxxxxxxxxxx. JJJJOOOOBBBBSSSS If the MMMMOOOONNNNIIIITTTTOOOORRRR option is set, an interactive shell associates a _j_o_b with each pipeline. It keeps a table of current jobs, printed by the jjjjoooobbbbssss command, and assigns them small integer numbers. When a job is started asynchronously with &&&&, the shell prints a line which looks like: [1] 1234 Page 9 (printed 4/24/98) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) zzzzsssshhhh vvvveeeerrrrssssiiiioooonnnn 3333....0000 ((((JJJJuuuunnnneeee 22226666,,,, 1111999999996666)))) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) indicating that the job which was started asynchronously was job number 1 and had one (top-level) process, whose process id was 1234. If a job is started with &&&&|||| or &&&&!!!!, then that job is immediately disowned. After startup, it does not have a place in the job table, and is not subject to the job control features described here. If you are running a job and wish to do something else you may hit the key ^^^^ZZZZ (control-Z) which sends a TSTP signal to the current job. The shell will then normally indicate that the job has been `suspended', and print another prompt. You can then manipulate the state of this job, putting it in the background with the bbbbgggg command, or run some other commands and then eventually bring the job back into the foreground with the foreground command ffffgggg. A ^^^^ZZZZ takes effect immediately and is like an interrupt in that pending output and unread input are discarded when it is typed. A job being run in the background will suspend if it tries to read from the terminal. Background jobs are normally allowed to produce output, but this can be disabled by giving the command ``stty tostop''. If you set this tty option, then background jobs will suspend when they try to produce output like they do when they try to read input. There are several ways to refer to jobs in the shell. A job can be referred to by the process id of any process of the job or by one of the following: %%%%_n_u_m_b_e_r The job with the given number. %%%%_s_t_r_i_n_g Any job whose command line begins with _s_t_r_i_n_g. %%%%????_s_t_r_i_n_g Any job whose command line contains _s_t_r_i_n_g. %%%%%%%% Current job. %%%%++++ Equivalent to %%%%%%%%. %%%%---- Previous job. The shell learns immediately whenever a process changes state. It normally informs you whenever a job becomes blocked so that no further progress is possible. If nnnnoooottttiiiiffffyyyy is not set, it waits until just before it prints a prompt before it informs you. When the monitor mode is on, each background job that completes triggers any trap set for CCCCHHHHLLLLDDDD. When you try to leave the shell while jobs are running or suspended, you will be warned that `You have suspended (running) jobs.' You may use the jjjjoooobbbbssss command to see what Page 10 (printed 4/24/98) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) zzzzsssshhhh vvvveeeerrrrssssiiiioooonnnn 3333....0000 ((((JJJJuuuunnnneeee 22226666,,,, 1111999999996666)))) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) they are. If you do this or immediately try to exit again, the shell will not warn you a second time; the suspended jobs will be terminated, and the running jobs will be sent a SSSSIIIIGGGGHHHHUUUUPPPP signal. To avoid having the shell terminate the running jobs, either use the nnnnoooohhhhuuuupppp(1) command or the ddddiiiissssoooowwwwnnnn builtin (see below). SSSSIIIIGGGGNNNNAAAALLLLSSSS The INT and QUIT signals for an invoked command are ignored if the command is followed by &&&& and the job MMMMOOOONNNNIIIITTTTOOOORRRR option is not active. Otherwise, signals have the values inherited by the shell from its parent (but see the TTTTRRRRAAAAPPPPxxxxxxxxxxxx special function above). AAAARRRRIIIITTTTHHHHMMMMEEEETTTTIIIICCCC EEEEVVVVAAAALLLLUUUUAAAATTTTIIIIOOOONNNN An ability to perform integer arithmetic is provided with the builtin lllleeeetttt. Evaluations are performed using _l_o_n_g arithmetic. A leading _0_x or _0_X denotes hexadecimal. Otherwise, numbers are of the form [_b_a_s_e####]_n where _b_a_s_e is a decimal number between two and thirty-six representing the arithmetic base and _n is a number in that base (for example, `16#ff' is 255 in hexadecimal). If _b_a_s_e is omitted then base 10 is used. For backwards compatibility the form `[16]ff' is also accepted. An arithmetic expression uses nearly the same syntax, precedence, and associativity of expressions in C. The following operators are supported (listed in decreasing order of precedence): ++++ ---- !!!! ++++++++ -------- u~~~~nary plus/minus, logical NOT, complement, {pre,post}{in,de}crement <<<<<<<< >>>>>>>> bitwise shift left, right &&&& bitwise AND ^^^^ bitwise XOR |||| bitwise OR ******** exponentiation **** //// %%%% multiplication, division, modulus (remainder) ++++ ---- addition, subtraction <<<< >>>> <<<<==== >>>>==== comparison ======== !!!!==== equality and inequality &&&&&&&& logical AND |||||||| ^^^^^^^^ logical OR, XOR ???? :::: ternary operator ==== ++++==== ----==== ****==== ////==== %%%%==== &&&&==== ^^^^==== ||||==== <<<<<<<<==== >>>>>>>>==== &&&&&&&&==== ||||||||==== ^^^^^^^^==== ********==== assignment Page 11 (printed 4/24/98) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) zzzzsssshhhh vvvveeeerrrrssssiiiioooonnnn 3333....0000 ((((JJJJuuuunnnneeee 22226666,,,, 1111999999996666)))) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) ,,,, comma operator The operators &&, ||, &&=, and ||= are short-circuiting, and only one of the latter two expressions in a ternary operator is evaluated. Note the precedence of the bitwise AND, OR, and XOR operators. An expression of the form ####\\\\xxxx where xxxx is any character gives the ascii value of this character and an expression of the form ####ffffoooooooo gives the ascii value of the first character of the value of the parameter ffffoooooooo. Named parameters and subscripted arrays can be referenced by name within an arithmetic expression without using the parameter substitution syntax. An internal integer representation of a named parameter can be specified with the iiiinnnntttteeeeggggeeeerrrr builtin. Arithmetic evaluation is performed on the value of each assignment to a named parameter declared integer in this manner. Since many of the arithmetic operators require quoting, an alternative form of the lllleeeetttt command is provided. For any command which begins with a ((((((((, all the characters until a matching )))))))) are treated as a quoted expression. More precisely, ((((((((...)))))))) is equivalent to lllleeeetttt """"..."""". CCCCOOOONNNNDDDDIIIITTTTIIIIOOOONNNNAAAALLLL EEEEXXXXPPPPRRRREEEESSSSSSSSIIIIOOOONNNNSSSS A _c_o_n_d_i_t_i_o_n_a_l _e_x_p_r_e_s_s_i_o_n is used with the [[[[[[[[ compound command to test attributes of files and to compare strings. Each expression can be constructed from one or more of the following unary or binary expressions: ----aaaa _f_i_l_e true if _f_i_l_e exists. ----bbbb _f_i_l_e true if _f_i_l_e exists and is a block special file. ----cccc _f_i_l_e true if _f_i_l_e exists and is a character special file. ----dddd _f_i_l_e true if _f_i_l_e exists and is a directory. ----eeee _f_i_l_e true if _f_i_l_e exists. ----ffff _f_i_l_e true if _f_i_l_e exists and is an ordinary file. ----gggg _f_i_l_e true if _f_i_l_e exists and has its setgid bit set. ----hhhh _f_i_l_e true if _f_i_l_e exists and is a symbolic link. ----kkkk _f_i_l_e true if _f_i_l_e exists and has its sticky bit set. ----nnnn _s_t_r_i_n_g true if length of _s_t_r_i_n_g is non-zero. Page 12 (printed 4/24/98) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) zzzzsssshhhh vvvveeeerrrrssssiiiioooonnnn 3333....0000 ((((JJJJuuuunnnneeee 22226666,,,, 1111999999996666)))) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) ----oooo _o_p_t_i_o_n true if option named _o_p_t_i_o_n is on. _o_p_t_i_o_n may be a single character, in which case it is a single letter option name. (See the SSSSPPPPEEEECCCCIIIIFFFFYYYYIIIINNNNGGGG OOOOPPPPTTTTIIIIOOOONNNNSSSS section of the _z_s_h_o_p_t_i_o_n_s(1) man page.) ----pppp _f_i_l_e true if _f_i_l_e exists and is a fifo special file or a pipe. ----rrrr _f_i_l_e true if _f_i_l_e exists and is readable by current process. ----ssss _f_i_l_e true if _f_i_l_e exists and has size greater than zero. ----tttt _f_d true if file descriptor number _f_d is open and associated with a terminal device. (note: _f_d is not optional) ----uuuu _f_i_l_e true if _f_i_l_e exists and has its setuid bit set. ----wwww _f_i_l_e true if _f_i_l_e exists and is writable by current process. ----xxxx _f_i_l_e true if _f_i_l_e exists and is executable by current process. If _f_i_l_e exists and is a directory, then the current process has permission to search in the directory. ----zzzz _s_t_r_i_n_g true if length of _s_t_r_i_n_g is zero. ----LLLL _f_i_l_e true if _f_i_l_e exists and is a symbolic link. ----OOOO _f_i_l_e true if _f_i_l_e exists and is owned by the effective user id of this process. ----GGGG _f_i_l_e true if _f_i_l_e exists and its group matches the effective group id of this process. ----SSSS _f_i_l_e true if _f_i_l_e exists and is a socket. ----NNNN _f_i_l_e true if _f_i_l_e exists and its access time is not newer than its modification time. _f_i_l_e_1 ----nnnntttt _f_i_l_e_2 true if _f_i_l_e_1 exists and is newer than _f_i_l_e_2. _f_i_l_e_1 ----ooootttt _f_i_l_e_2 true if _f_i_l_e_1 exists and is older than _f_i_l_e_2. _f_i_l_e_1 ----eeeeffff _f_i_l_e_2 true if _f_i_l_e_1 and _f_i_l_e_2 exist and refer to the same file. _s_t_r_i_n_g ======== _p_a_t_t_e_r_n _s_t_r_i_n_g ==== _p_a_t_t_e_r_n true if _s_t_r_i_n_g matches _p_a_t_t_e_r_n. The first form is the preferred one. The other form is for backward compatibility and should be considered obsolete. Page 13 (printed 4/24/98) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) zzzzsssshhhh vvvveeeerrrrssssiiiioooonnnn 3333....0000 ((((JJJJuuuunnnneeee 22226666,,,, 1111999999996666)))) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) _s_t_r_i_n_g !!!!==== _p_a_t_t_e_r_n true if _s_t_r_i_n_g does not match _p_a_t_t_e_r_n. _s_t_r_i_n_g_1 <<<< _s_t_r_i_n_g_2 true if _s_t_r_i_n_g_1 comes before _s_t_r_i_n_g_2 based on ASCII value of their characters. _s_t_r_i_n_g_1 >>>> _s_t_r_i_n_g_2 true if _s_t_r_i_n_g_1 comes after _s_t_r_i_n_g_2 based on ASCII value of their characters. _e_x_p_1 ----eeeeqqqq _e_x_p_2 true if _e_x_p_1 is equal to _e_x_p_2. _e_x_p_1 ----nnnneeee _e_x_p_2 true if _e_x_p_1 is not equal to _e_x_p_2. _e_x_p_1 ----lllltttt _e_x_p_2 true if _e_x_p_1 is less than _e_x_p_2. _e_x_p_1 ----ggggtttt _e_x_p_2 true if _e_x_p_1 is greater than _e_x_p_2. _e_x_p_1 ----lllleeee _e_x_p_2 true if _e_x_p_1 is less than or equal to _e_x_p_2. _e_x_p_1 ----ggggeeee _e_x_p_2 true if _e_x_p_1 is greater than or equal to _e_x_p_2. (((( _e_x_p )))) true if _e_x_p is true. !!!! _e_x_p true if _e_x_p is false. _e_x_p_1 &&&&&&&& _e_x_p_2 true if _e_x_p_1 and _e_x_p_2 are both true. _e_x_p_1 |||||||| _e_x_p_2 true if either _e_x_p_1 or _e_x_p_2 is true. In each of the above expressions, if _f_i_l_e is of the form ////ddddeeeevvvv////ffffdddd////_n, where _n is an integer, then the test applied to the open file whose descriptor number is _n, even if the underlying system does not support the ////ddddeeeevvvv////ffffdddd directory. CCCCOOOOMMMMPPPPAAAATTTTIIIIBBBBIIIILLLLIIIITTTTYYYY _Z_s_h tries to emulate _s_h or _k_s_h when it is invoked as _s_h or _k_s_h respectively. In this mode the following parameters are not special and not initialized by the shell: AAAARRRRGGGGCCCC, aaaarrrrggggvvvv, ccccddddppppaaaatttthhhh, ffffiiiiggggnnnnoooorrrreeee, ffffppppaaaatttthhhh, HHHHIIIISSSSTTTTCCCCHHHHAAAARRRRSSSS, mmmmaaaaiiiillllppppaaaatttthhhh, MMMMAAAANNNNPPPPAAAATTTTHHHH, mmmmaaaannnnppppaaaatttthhhh, ppppaaaatttthhhh, pppprrrroooommmmpppptttt, PPPPRRRROOOOMMMMPPPPTTTT, PPPPRRRROOOOMMMMPPPPTTTT2222, PPPPRRRROOOOMMMMPPPPTTTT3333, PPPPRRRROOOOMMMMPPPPTTTT4444, ppppssssvvvvaaaarrrr, ssssttttaaaattttuuuussss, wwwwaaaattttcccchhhh. The usual _z_s_h starup/shutdown scripts are not executed. Login shells source ////eeeettttcccc////pppprrrrooooffffiiiilllleeee followed by $$$$HHHHOOOOMMMMEEEE////....pppprrrrooooffffiiiilllleeee. If the EEEENNNNVVVV environment variable is set on invocation, $$$$EEEENNNNVVVV is sourced after the profile scripts. The value of EEEENNNNVVVV is subjected to parameter expansion, command substitution, and arithmetic expansion before being interpreted as a pathname. Note that the PPPPRRRRIIIIVVVVIIIILLLLEEEEGGGGEEEEDDDD option also affects the execution of startup files. See _z_s_h_o_p_t_i_o_n_s(%manext%) for more details. Page 14 (printed 4/24/98) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) zzzzsssshhhh vvvveeeerrrrssssiiiioooonnnn 3333....0000 ((((JJJJuuuunnnneeee 22226666,,,, 1111999999996666)))) ZZZZSSSSHHHHMMMMIIIISSSSCCCC((((1111)))) The following options are set if the shell is invoked as _s_h or _k_s_h: NNNNOOOO____BBBBAAAADDDD____PPPPAAAATTTTTTTTEEEERRRRNNNN, NNNNOOOO____BBBBAAAANNNNGGGG____HHHHIIIISSSSTTTT, NNNNOOOO____BBBBGGGG____NNNNIIIICCCCEEEE, NNNNOOOO____EEEEQQQQUUUUAAAALLLLSSSS, NNNNOOOO____FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN____AAAARRRRGGGGZZZZEEEERRRROOOO, GGGGLLLLOOOOBBBB____SSSSUUUUBBBBSSSSTTTT, NNNNOOOO____HHHHUUUUPPPP, IIIINNNNTTTTEEEERRRRAAAACCCCTTTTIIIIVVVVEEEE____CCCCOOOOMMMMMMMMEEEENNNNTTTTSSSS, KKKKSSSSHHHH____AAAARRRRRRRRAAAAYYYYSSSS, NNNNOOOO____MMMMUUUULLLLTTTTIIIIOOOOSSSS, NNNNOOOO____NNNNOOOOMMMMAAAATTTTCCCCHHHH, RRRRMMMM____SSSSTTTTAAAARRRR____SSSSIIIILLLLEEEENNNNTTTT, PPPPOOOOSSSSIIIIXXXX____BBBBUUUUIIIILLLLTTTTIIIINNNNSSSS, SSSSHHHH____FFFFIIIILLLLEEEE____EEEEXXXXPPPPAAAANNNNSSSSIIIIOOOONNNN, SSSSHHHH____GGGGLLLLOOOOBBBB, SSSSHHHH____OOOOPPPPTTTTIIIIOOOONNNN____LLLLEEEETTTTTTTTEEEERRRRSSSS, SSSSHHHH____WWWWOOOORRRRDDDD____SSSSPPPPLLLLIIIITTTT. Additionally the BBBBSSSSDDDD____EEEECCCCHHHHOOOO and the IIIIGGGGNNNNOOOORRRREEEE____BBBBRRRRAAAACCCCEEEESSSS options are set if _z_s_h is invoked as _s_h and the KKKKSSSSHHHH____OOOOPPPPTTTTIIIIOOOONNNN____PPPPRRRRIIIINNNNTTTT, LLLLOOOOCCCCAAAALLLL____OOOOPPPPTTTTIIIIOOOONNNNSSSS, PPPPRRRROOOOMMMMPPPPTTTT____SSSSUUUUBBBBSSSSTTTT and SSSSIIIINNNNGGGGLLLLEEEE____LLLLIIIINNNNEEEE____ZZZZLLLLEEEE options are set if _z_s_h is invoked as _k_s_h. Page 15 (printed 4/24/98)